package com.model;

import java.sql.Connection;
import java.sql.SQLException;
import oracle.jdbc.pool.OracleDataSource;

public class OraConnection {
    public static Connection open(String url, String userId, String password) {
//        String jdbcUrl = "jdbc:oracle:thin:@172.23.9.185:1521:orcl";
//        String userid = "MHS115314087";
//        String password = "MHS115314087";
        Connection conn = null;
        try {
            OracleDataSource ds;
            ds = new OracleDataSource();
            ds.setURL(url);
            conn = ds.getConnection(userId, password);
            System.out.println("Koneksi is OK");
        } catch (SQLException e) {
            // perform error handling here
            System.out.println("error :" + e.getMessage());
        }
        return conn;
    }
}
